<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        var n = prompt('输入一个数字帮你判断是否为质数'); 
var count = 0; 
for(var j = 1;j <= n; j++){ 
if(n%j == 0){ 
count++; 
} 
} 
if(count == 2){ 
alert('这是一个质数');
}else{ 
alert('这不是一个质数'); 
}
    </script>
</body>
</html>